import { createApp } from "vue";
import App from "@/App.vue";
import "@/styles/index.scss"; // 引入全局样式
import ElementPlus from "element-plus"; // 引入element-plus插件和图片插件
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import "element-plus/dist/index.css";
// @ts-ignore
import zhCn from "element-plus/dist/locale/zh-cn.mjs"; // 引入国际化配置
import "virtual:svg-icons-register"; // SVG 插件需要配置的代码:自动注册所有的SVG图标为Vue组件
import pinia from "./store"; // 引入pinia
import router from "./router"; // 引入路由
import gloablComponent from "@/components"; // 引入全局插件
import { req } from "./utils/request";
import VueDOMPurifyHTML from "vue-dompurify-html"; //引入DOMPurify 库
import { AvatarList, Form, FormItem, Select, Option, RadioGroup, Radio, } from 'view-ui-plus';//按需引入viewUi组件库
import 'view-ui-plus/dist/styles/viewuiplus.css';
import './styles/index.css'; // 引入Tailwind CSS样式

// 创建应用实例
const app = createApp(App);

app.config.globalProperties.$req = req;

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 安装element-plus插件
app.use(ElementPlus, {
  locale: zhCn,
});

app.use(gloablComponent);

app.use(pinia);

// 注册模板路由
app.use(router);

// 注册DOMPurify 库
app.use(VueDOMPurifyHTML);

// 注册viewUi组件
app.component("AvatarList", AvatarList);
app.component("Form", Form);
app.component("FormItem", FormItem);
app.component("Select", Select);
app.component("Option", Option);
app.component("RadioGroup", RadioGroup);
app.component("Radio", Radio);


// 将应用实例挂载
app.mount("#app");
